﻿using System;
using System.Collections.Generic;
using System.Text;
using Wangzeran.CodeMaker.Core.Model;

namespace Wangzeran.CodeMaker.Core.DB
{
    /// <summary>
    /// 数据库的架构信息
    /// </summary>
    public interface IDBSchema
    {
        /// <summary>
        /// 获取所有数据库信息
        /// </summary>
        /// <returns></returns>
        IDictionary<string, DatabaseModal> GetDatabases();

        /// <summary>
        /// 获取该数据库的所有表名
        /// </summary>
        /// <param name="databaseName">数据库名</param>
        /// <returns></returns>
        IList<string> GetTableNames(string databaseName);

        /// <summary>
        /// 获取该数据库的相关表的详细信息集合
        /// </summary>
        /// <param name="databaseName">数据库名</param>
        /// <param name="tableNames">表名集合</param>
        /// <returns>当前数据库名称的表名集合</returns>
        IDictionary<string, TableModal> GetTables(string databaseName, string[] tableNames);

        /// <summary>
        /// 获取当前数据库的所有表信息
        /// </summary>
        /// <param name="databaseName">数据库名称</param>
        /// <returns>当前数据库名称的表名集合</returns>
        IDictionary<string, TableModal> GetTables(string databaseName);

        /// <summary>
        /// 获取当前表的所有列信息
        /// </summary>
        /// <param name="databaseName">数据库名称</param>
        /// <param name="tableName">表名</param>
        /// <returns>当前表的所有列信息</returns>
        IDictionary<string, ColumnModal> GetColumns(string databaseName, string tableName);
    }
}
